﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Arizu.Repository;
using Arizu.Entity;
using System.Web.SessionState;

namespace AiRiZu.User.handler
{
    public class UpdateUserInfo : IHttpHandler, IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            if (context.Session["logId"] == null)
            {
                return;
            }
            UserEntity user = new UserEntity();

            user.UserId = long.Parse(context.Session["logId"].ToString());

            user.Xing = context.Request.Params["Xing"].ToString();

            user.Ming = context.Request.Params["Ming"].ToString();

            user.Email = context.Request.Params["Email"].ToString();

            user.MobileTelephone = context.Request.Params["MobileTelephone"].ToString();

            //user.Pass = context.Request.Params["Pass"].ToString();

            user.Sex = int.Parse(context.Request.Params["Sex"].ToString());

            user.School = context.Request.Params["School"].ToString();

            user.Adress = context.Request.Params["Adress"].ToString();

            user.Work = context.Request.Params["Work"].ToString();

            user.TelephoneBack = context.Request.Params["TelephoneBack"].ToString();

            user.MyDesc = context.Request.Params["MyDesc"].ToString();

            user.TravelPlans = context.Request.Params["TravelPlans"].ToString();

            AirizuUser airizuUser = AirizuUser.CreateInstance();

            airizuUser.UpdateUserInfo(user);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
